/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import com.j256.ormlite.field.DatabaseField;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Juanan
 */
@Entity(name = "usr_user")
public class UsrUser implements Serializable
{
    private static final long serialVersionUID = 1L;
    public static final String USR_LOGIN = "USR_LOGIN";
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "USR_ID")
    private Integer usrId;
    @Column(name = "USR_FIRST_NAME")
    private String usrFirstName;
    @Column(name = "USR_LAST_NAME")
    private String usrLastName;
    @Column(name = "USR_LOGIN")
    private String usrLogin;
    @Column(name = "USR_PASSWORD")
    private String usrPassword;
    @Column(name = "USR_MAIL")
    private String usrMail;
    @Column(name = "USR_PHONE")
    private String usrPhone;
    @Column(name = "PAR_LANGUAGE")
    private String parLanguage;
    @JoinColumn(name = "GRP_ID", referencedColumnName = "GRP_ID")
    @ManyToOne(optional = false)
    @DatabaseField(columnName= "GRP_ID", canBeNull = false, foreign = true, foreignAutoRefresh=true)
    private GrpGroup grpId;

    public UsrUser()
    {
    }

    public UsrUser(Integer usrId)
    {
        this.usrId = usrId;
    }

    public Integer getUsrId()
    {
        return usrId;
    }

    public void setUsrId(Integer usrId)
    {
        this.usrId = usrId;
    }

    public String getUsrFirstName()
    {
        return usrFirstName;
    }

    public void setUsrFirstName(String usrFirstName)
    {
        this.usrFirstName = usrFirstName;
    }

    public String getUsrLastName()
    {
        return usrLastName;
    }

    public void setUsrLastName(String usrLastName)
    {
        this.usrLastName = usrLastName;
    }

    public String getUsrLogin()
    {
        return usrLogin;
    }

    public void setUsrLogin(String usrLogin)
    {
        this.usrLogin = usrLogin;
    }

    public String getUsrPassword()
    {
        return usrPassword;
    }

    public void setUsrPassword(String usrPassword)
    {
        this.usrPassword = usrPassword;
    }

    public String getUsrMail()
    {
        return usrMail;
    }

    public void setUsrMail(String usrMail)
    {
        this.usrMail = usrMail;
    }

    public String getUsrPhone()
    {
        return usrPhone;
    }

    public void setUsrPhone(String usrPhone)
    {
        this.usrPhone = usrPhone;
    }

    public String getParLanguage()
    {
        return parLanguage;
    }

    public void setParLanguage(String parLanguage)
    {
        this.parLanguage = parLanguage;
    }

    public GrpGroup getGrpId()
    {
        return grpId;
    }

    public void setGrpId(GrpGroup grpId)
    {
        this.grpId = grpId;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (usrId != null ? usrId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UsrUser))
        {
            return false;
        }
        UsrUser other = (UsrUser) object;
        if ((this.usrId == null && other.usrId != null) || (this.usrId != null && !this.usrId.equals(other.usrId)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "entities.UsrUser[ usrId=" + usrId + " ]";
    }
    
}
